/*
 * Copyright (c) 2006 - 2022, webrx.cn All rights reserved.
 *
 */
package cn.demo;

import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
 * <p>Project: app2022 - Stream7
 * <p>Powered by webrx On 2022-01-26 15:54:38
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class Stream7 {
    public static void main(String[] args) {
        Stream<Integer> si = List.of(1, 2, 3, 4, 5).stream();
        si.mapMultiToDouble((a, b) -> b.accept(a + .5)).forEach(System.out::println);
        //IntStream i1 = si.mapToInt(a -> a * a);
        //i1.forEach(System.out::println);

        var is = Stream.of(
                new Student(1, "李四", "男", 18),
                new Student(22, "James Gosling", "男", 68),
                new Student(2, "张三", "男", 28),
                new Student(3, "王五", "男", 38),
                new Student(1, "李四", "男", 18),
                new Student(4, "李丽", "女", 25)
        );

        //System.out.println(is.map(Student::getName).collect(Collectors.toList()));
        System.out.println(is.map(Student::getName).collect(Collectors.joining("-")));

        //is.mapToInt(e->e.getAge()).forEach(System.out::println);
        //is.mapToInt(Student::getAge).forEach(System.out::println);
        //is.mapToInt((e) -> 1).forEach(System.out::println);
    }
}
